{{useCss "/app-pages/css/admin/message.scss"}}
<div class="message">
    <div class="default">
        <div class="title">默认回复</div>
        <div class="content">
            <div class="type">
                回复类型：
                <select bind-input="{{'$Cache.admin.message.config.default.type'}}" bind-value="{{$Cache.admin.message.config.default.type}}">
                    <option value="text" selected="{{($Cache.admin.message.config.default.type=='text')||!$Cache.admin.message.config.default.type}}">文本</option>
                    <option value="image" selected="{{$Cache.admin.message.config.default.type=='image'}}">图片</option>
                    <option value="news" selected="{{$Cache.admin.message.config.default.type=='news'}}">图文</option>
                </select>
            </div>
            <div class="context">
            	{{#if $Cache.admin.message.config.default.type=='news'}}
				<!-- title,description,picurl,url-->
				<input class="news" type="text" maxlength="16" bind-input="{{'$Cache.admin.message.config.default.title'}}" bind-value="{{$Cache.admin.message.config.default.title}}" placeholder="请输入标题" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'$Cache.admin.message.config.default.description'}}" bind-value="{{$Cache.admin.message.config.default.description}}" placeholder="请输入图文描述" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'$Cache.admin.message.config.default.picurl'}}" bind-value="{{$Cache.admin.message.config.default.picurl}}" placeholder="请输入图片链接" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'$Cache.admin.message.config.default.url'}}" bind-value="{{$Cache.admin.message.config.default.url}}" placeholder="请输入图文链接" />
				{{#else}}
                {{(($Cache.admin.message.config.default.type=='text'||!$Cache.admin.message.config.default.type)?'请输入文本内容':'请输入资源id')}}：
                <textarea bind-input="{{'$Cache.admin.message.config.default.message'}}" bind-value="{{$Cache.admin.message.config.default.message}}" placeholder="请输入回复内容" maxlength="128"></textarea>
            	{{/if}}
            </div>
        </div>
    </div>
    <table>
        <!-- name,type,message -->
        <thead>
            <td>操作</td>
            <td>模板名</td>
            <td>回复类型</td>
            <td>回复内容</td>
        </thead>
        {{#each $Cache.admin.message.config.message_config}}
        <tr>
            <td>
                <a event-click="{{'$Top.$Event.admin.message.removeItem'}}">删除此模板</a>
            </td>
            <td>
                <input type="text" bind-value="{{name}}" bind-input="{{'name'}}" placeholder="模板名" />
            </td>
            <td>
                <select bind-input="{{'type'}}" bind-value="{{type}}">
                    <option value="text" selected="{{(type=='text')||!type}}">文本</option>
                    <option value="image" selected="{{type=='image'}}">图片</option>
                    <option value="news" selected="{{type=='news'}}">图文</option>
                </select>
            </td>
            <td>
            	{{#if type=='news'}}
				<!-- title,description,picurl,url-->
				<input class="news" type="text" maxlength="16" bind-input="{{'title'}}" bind-value="{{title}}" placeholder="请输入标题" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'description'}}" bind-value="{{description}}" placeholder="请输入图文描述" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'picurl'}}" bind-value="{{picurl}}" placeholder="请输入图片链接" />
				<br />
				<input class="news" type="text" maxlength="128" bind-input="{{'url'}}" bind-value="{{url}}" placeholder="请输入图文链接" />
				{{#else}}
                <textarea bind-input="{{'message'}}" bind-value="{{message}}" placeholder="请输入回复内容" maxlength="128"></textarea>
                {{/if}}
            </td>
        </tr>
        {{/each}} 
        {{#if (5>$Cache.admin.message.config.message_config.length)||!$Cache.admin.message.config.message_config}}
        <tr>
            <td colspan="4">
                <button event-click="{{'$Event.admin.message.addOne'}}">增加自动回复</button>
            </td>
        </tr>
        {{/if}}
    </table>

    <div class="methods">
    	<button event-click="{{'$Event.admin.message.submit'}}">提交</button>
    </div>
</div>
